package com.example.consumer.controller;

import com.example.consumer.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/city")
public class CityController {

    @Autowired
    CityService cityService;

    @RequestMapping("/findall")
    public Object findAll(){
        return cityService.findAll();
    }

    @RequestMapping("/findbyname/{name}")
    public Object findByCode(@PathVariable String name){
        return cityService.findByName(name);
    }
}
